import subprocess


# 读取malwaresha256.csv文件中的sha256字段数据
with open('malwaresha256.csv', 'r') as file:
    sha256_list = file.readlines()

# 去除每条数据末尾的换行符
sha256_list = [sha256.strip() for sha256 in sha256_list]

# 设置API密钥
apikey = '448ba5fa0757c68678804dd0abdc06a59cbfab839897c8c4e157a63313a6db55'

# 执行5000次curl命令
for i, sha256 in enumerate(sha256_list[:5000], start=1):
    command = f"curl -O  --remote-header-name -G -d apikey={apikey} -d sha256={sha256} https://androzoo.uni.lu/api/download -o /malware"
    subprocess.run(command, shell=True, cwd='malware')
    print(f"Downloaded APK {i}/5000")

print("Download completed.")